package psd.model.Prolog.Converters;

import org.eclipse.jdt.core.dom.MethodInvocation;

import psd.model.IConverter;
import psd.model.Prolog.FactGenerationToolbox;
import psd.model.Prolog.PrologConverter;


public class PrologMethodInvocationConverter extends PrologConverter implements
		IConverter<MethodInvocation> {

	public PrologMethodInvocationConverter(FactGenerationToolbox toolbox) {
		super(toolbox);
	}

	@Override
	public boolean convert(MethodInvocation node) {
	    node.resolveTypeBinding();
        String args[] = {
            idResolver.getID(node.getExpression()), quote(node.getName().getIdentifier()), idResolver.getIDs(node.arguments()), idResolver.getID(node.resolveMethodBinding())
        };
        if(args[3] == "resolve_failed")
        {
            CALLT_THAT_NEED_IDENT.add(node);
        }
        createBodyFact(node, "callT", args);
        writeSourceLocationArgumentIdentifier(node, node.getName());
        return true;
	}


}
